{extend name="common/base"/}
{block name="style"}
<link rel="stylesheet" href="{__GOUGU__}/gougu/module/prism/prism.css?v=1"/>
<link rel="stylesheet" href="{__JS__}/viewer/viewer.min.css?v=1"/>
<link rel="stylesheet" href="{__CSS__}/detail.css?v=1"/>
{/block}
{block name="title"}
<title>{$detail.title}</title>
{/block}
{block name="keywords"}
<meta name="keywords" content="{$detail.keyword_names}" />
<meta name="description" content="{$detail.desc}" />
{/block}
<!-- 主体 -->
{block name="body"}
{include file="common/header" nav='index' /}
<div class="detail">
	<h1 class="detail-title">
		{$detail.title}
	</h1>
	<div class="detial-ops">
		<span>发表于：{$detail.create_time}</span><span>浏览：{$detail.read}次</span><span class="color-tags">TAG：{foreach name='$detail.keyword_array' item='vo'}
			<a href="#" title="{$vo.title}">#{$vo.title}</a>
		{/foreach}</span>
	</div>
	<div id="Detail" class="detial-content">
		{$detail.content|raw}
	</div>
</div>
{/block}
<!-- 脚本 -->
{block name="script"}
<script src="{__GOUGU__}/gougu/module/prism/prism.js?v=1"></script>
<script src="{__JS__}/viewer/viewer.min.js?v=1"></script>
<script>
	function unhtml(str, reg) {
        return str ? str.replace(reg || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function (a, b) {
            if (b) {
                return a;
            } else {
                return {
                    '<':'&lt;',
                    '&':'&amp;',
                    '"':'&quot;',
                    '>':'&gt;',
                    "'":'&#39;'
                }[a]
            }

        }) : '';
    }
    var $codepre = $("pre[class]");
	if($codepre.length>0){
		for(var i = 0;i<$codepre.length;i++){
			var item = $codepre.eq(i);
			var language = "";
			item.attr("class").replace(/brush:([^;]+)/,function(a,b){
				language = b;
			});
			if(language){
				var codehtml = item.html();
				var code = $("<code>");
				code.attr("class","language-"+language+" line-numbers");
				//codehtml= unhtml(codehtml);
				code.html(codehtml);
				item.html(code);
				Prism.highlightElement(code[0]);
			}
		}
	}
	
	var $code=$("code[class]");
	if($code.length>0){
		for(var i = 0;i<$code.length;i++){
			var item = $code.eq(i);
			item.addClass("line-numbers");
			//Prism.highlightElement(item);
		}
	}
	var viewer = new Viewer(document.getElementById('Detail'));
</script>
{/block}
<!-- /脚本 -->